home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1999 January / PC Plus Super CD No55a (PCP-147A-1-99) (Disc 1) (1998).iso / linux / developers / visualtcl / windows / vtcl / demo / grid.tcl < prev    next >
Encoding:
Text File  |  1997-03-27  |  3.5 KB  |  132 lines

  1. #############################################################################
  2. # Visual Tcl v1.07 Project
  3. #
  4.  
  5. #################################
  6. # GLOBAL VARIABLES
  7. #
  8. global w; set w {.top1.fra2.but8}
  9. global widget; 
  10. #################################
  11. # USER DEFINED PROCEDURES
  12. #
  13. proc init {argc argv} {
  14.  
  15. }
  16.  
  17. init $argc $argv
  18.  
  19.  
  20. proc main {argc argv} {
  21.  
  22. }
  23.  
  24. proc Window {args} {
  25. global vTcl
  26.     set cmd [lindex $args 0]
  27.     set name [lindex $args 1]
  28.     set rest [lrange $args 2 end]
  29.     if {$name == "" || $cmd == ""} {return}
  30.     set exists [winfo exists $name]
  31.     switch $cmd {
  32.         show {
  33.             if {[info procs vTclWindow(pre)$name] != ""} {
  34.                 vTclWindow(pre)$name $rest
  35.             }
  36.             if {[info procs vTclWindow$name] != ""} {
  37.                 vTclWindow$name
  38.             }
  39.             if {[info procs vTclWindow(post)$name] != ""} {
  40.                 vTclWindow(post)$name $rest
  41.             }
  42.         }
  43.         hide    { if $exists {wm withdraw $name; return} }
  44.         iconify { if $exists {wm iconify $name; return} }
  45.         destroy { if $exists {destroy $name; return} }
  46.     }
  47. }
  48.  
  49. #################################
  50. # VTCL GENERATED GUI PROCEDURES
  51. #
  52.  
  53. proc vTclWindow. {args} {
  54.     set base .
  55.     ###################
  56.     # CREATING WIDGETS
  57.     ###################
  58.     wm focusmodel . passive
  59.     wm geometry . 1x1+0+0
  60.     wm maxsize . 1137 870
  61.     wm minsize . 1 1
  62.     wm overrideredirect . 0
  63.     wm resizable . 1 1
  64.     wm withdraw .
  65.     wm title . "vt.tcl"
  66.     ###################
  67.     # SETTING GEOMETRY
  68.     ###################
  69. }
  70.  
  71. proc vTclWindow.top1 {args} {
  72.     set base .top1
  73.     if {[winfo exists .top1]} {
  74.         wm deiconify .top1; return
  75.     }
  76.     ###################
  77.     # CREATING WIDGETS
  78.     ###################
  79.     toplevel .top1 -class Toplevel \
  80.         -background #e3e2e3 
  81.     wm focusmodel .top1 passive
  82.     wm geometry .top1 226x116+103+182
  83.     wm maxsize .top1 1137 870
  84.     wm minsize .top1 1 1
  85.     wm overrideredirect .top1 0
  86.     wm resizable .top1 1 1
  87.     wm deiconify .top1
  88.     wm title .top1 "Grid Geometry"
  89.     frame .top1.fra6 \
  90.         -borderwidth 1 -height 30 -relief sunken -width 30 
  91.     button .top1.fra6.0 \
  92.         -background #afd9c7 \
  93.         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
  94.         -pady 3 -text one -width 5 
  95.     button .top1.fra6.1 \
  96.         -background #d9ab70 \
  97.         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
  98.         -pady 3 -text three -width 5 
  99.     button .top1.fra6.2 \
  100.         -background #d99bae \
  101.         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
  102.         -pady 3 -text two -width 5 
  103.     button .top1.fra6.3 \
  104.         -background #1d8fb2 \
  105.         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
  106.         -pady 3 -text five -width 5 
  107.     button .top1.fra6.4 \
  108.         -background #7eb5cb \
  109.         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
  110.         -pady 3 -text four -width 5 
  111.     ###################
  112.     # SETTING GEOMETRY
  113.     ###################
  114.     pack .top1.fra6 \
  115.         -anchor center -expand 1 -fill both -padx 5 -pady 5 -side top 
  116.     grid .top1.fra6.0 \
  117.         -column 0 -row 0 -columnspan 2 -rowspan 1 -sticky ew 
  118.     grid .top1.fra6.1 \
  119.         -column 1 -row 1 -columnspan 1 -rowspan 1 
  120.     grid .top1.fra6.2 \
  121.         -column 0 -row 1 -columnspan 1 -rowspan 1 
  122.     grid .top1.fra6.3 \
  123.         -column 0 -row 2 -columnspan 3 -rowspan 1 -sticky ew 
  124.     grid .top1.fra6.4 \
  125.         -column 2 -row 0 -columnspan 1 -rowspan 2 -sticky ns 
  126. }
  127.  
  128. Window show .
  129. Window show .top1
  130.  
  131. main $argc $argv
  132.